<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>店铺管理</title>
<meta name="description" content="拉勾数据">
<meta name="keywords" content="二手房 房产经济 房企 开发商 拉勾数据 IFS">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed"
	href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="eosms for IFS" />
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="assets/css/admin.css">
</head>
<body>
	<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

	<jsp:include page="/manage_header.do" flush="true" />

	<div class="am-cf admin-main">
		<!-- sidebar start -->
		<jsp:include page="/manage_tree.do" flush="true" ></jsp:include>
		<!-- sidebar end -->

		<!-- content start -->
		<div class="admin-content">

			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">店铺</strong> / <small>store</small>
				</div>
			</div>
				<div class="am-tabs am-margin" data-am-tabs>
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="#tab1">基本信息</a></li>
					</ul>
			<div class="am-g" id="formdiv" name="${flog }">
				<div class="am-u-sm-12">
					<form class="am-form" id="storeform" action="add_businessbyname.do">
					<input type="hidden" name="storeid" id="storeid" value="${store_id }">
						<table id="clients_table"
							class="am-table am-table-striped am-table-hover table-main" name="${flag }">
							<thead>
								<tr>
								    <th class="table-title" width="10%"></th>
									<th class="table-title" width="20%">ID</th>
									<th class="table-title" width="20%">业务员名称</th>
									<th class="table-title" width="20%">店铺名称</th>
									<th class="table-title" width="20%">查看位置</th>
									<th class="table-title" width="10%">状态</th>
								</tr>
							</thead>
							<tbody id="data_tbody">
							<c:if test="${size==0 }">没有可以关联的工单</c:if>
							<c:if test="${size!=0 }">
								<c:forEach var="list" items="${businesslists}" varStatus="s">
									<tr class="tr_click" ad_id="${list.id}">
									
									<td class="td_check">
									<c:if test="${list.is_relation==1}">
									<input type="checkbox" name="checktd" value="${list.id}" checked="checked"/></c:if>
									<c:if test="${list.is_relation==0}">
									<input type="checkbox" name="checktd" value="${list.id}"/></c:if>
									</td>
										<td>${list.id}</td>
										<td>${list.adminuser.name}</td>
										<td>${list.shopname}</td>
										<td class="td1">
											<a href="views/business/get_map.jsp?x=${list.address_x}&y=${list.address_y}" target="_blank">	查看位置 </a>
											</td>
											<td class="td2"><c:choose>
												<c:when test="${list.status==1}">  
         											  可用     
   												</c:when>
												<c:otherwise> 
													   禁用 
  											    </c:otherwise>
											</c:choose>
											</td>
									</tr>
								</c:forEach>
								</c:if>
							</tbody>
						</table>
						 <div class="am-margin am-text-right">
							<button type="button" id="group_button"
								class="am-btn am-btn-primary am-btn-xs">关联</button>
							
						</div>
						
						<div class="am-cf">
							共 <b id="pageCount">${page.allRow}</b> 条记录
							<div class="am-fr">
								<ul class="am-pagination">
									<c:choose>
										<c:when test="${page.currentPage==1}">
											<li class="am-disabled"><a href="#">«</a></li>
										</c:when>
										<c:when test="${page.currentPage!=1}">
											<li><a href="javascript:void(0)"
												onclick="choose_page(${page.currentPage-1})">«</a></li>
										</c:when>
									</c:choose>
									<c:forEach var="i" begin="1" end="${page.totalPage}" step="1">
										<c:choose>
											<c:when test="${page.currentPage==i}">
												<li class="am-active"><a href="javascript:void(0)"><c:out
															value="${i}" /></a></li>
											</c:when>
											<c:when test="${page.currentPage!=i}">
												<li><a href="javascript:void(0)"
													onclick="choose_page(${i})"><c:out value="${i}" /></a></li>
											</c:when>
										</c:choose>
									</c:forEach>
									<c:choose>
										<c:when test="${page.currentPage==page.totalPage}">
											<li class="am-disabled"><a href="#">»</a></li>
										</c:when>
										<c:when test="${page.currentPage!=page.totalPage}">
											<li><a href="javascript:void(0)"
												onclick="choose_page(${page.currentPage+1})">»</a></li>
										</c:when>
									</c:choose>
								</ul>
							</div>
						</div>
						
					</form>
				</div>
			</div>
		</div>

		<!-- content end -->

	</div>
	</div>

	<a href="#" class="am-show-sm-only admin-menu"
		data-am-offcanvas="{target: '#admin-offcanvas'}"> <span
		class="am-icon-btn am-icon-th-list"></span>
	</a>

	<jsp:include page="/manage_foot.do" flush="true" />

	<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

	<!--[if (gte IE 9)|!(IE)]><!-->
	<script src="assets/js/jquery.min.js"></script>
	<!--<![endif]-->
	<script src="assets/js/amazeui.min.js"></script>
	<script src="assets/js/app.js"></script>
	<script type="text/javascript">
	
$(function() {
	//页面初始化时默认新增机构，所以隐藏新增按钮
	if($("#formdiv").attr("name")==1 && $("#clients_table").attr("name")==1)
	{
	alert("关联成功");
	location.href="<%=request.getContextPath()%>/show_add_store.do";
	}
else if($("formdiv").attr("name")==0 && $("#clients_table").attr("name")==0){
	alert("关联失败");
}
	if( $("#clients_table").attr("name")==3)
		{
		alert("取消关联成功");
		location.href="<%=request.getContextPath()%>/show_add_store.do";
		}
	if( $("#clients_table").attr("name")==4)
	{
	alert("请勾选关联对象");
	location.href="<%=request.getContextPath()%>/show_businessbyname.do?store_id="+$("#storeid").val()+"";
	}
	$("#group_button").click(function(){
	
		 $("#storeform").submit();
	});
	
});

function choose_page(i){
	$("#page_num").val(i);
	$("#store_form").submit();
}
</script>
</body>
</html>
